package cn.edu.sdjzu.xg2106.util;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;

import java.util.List;

public class ControllerHelper {
    public static List<Condition> getConditions(JSONObject req_jsonObj){
        JSONArray conditionList_jsonArray = req_jsonObj.getJSONArray("conditionList");
        List<Condition> conditionList = null;
        if (conditionList_jsonArray != null){
            conditionList = conditionList_jsonArray.toJavaList(Condition.class);
        }
        return conditionList;
    }
    public static Pagination getPagination(JSONObject req_jsonObj){
        JSONObject pagination_jsonObject = req_jsonObj.getJSONObject("pagination");
        Pagination pagination = null;
        if (pagination_jsonObject != null){
            pagination=pagination_jsonObject.toJavaObject(Pagination.class);
        }
        return pagination;
    }
}
